package com.mk.seckill.controller;

import com.mk.seckill.pojo.User;
import com.mk.seckill.service.IOrderService;
import com.mk.seckill.vo.OrderDetailVo;
import com.mk.seckill.vo.RespBean;
import com.mk.seckill.vo.RespBeanEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/order")
public class OrderController {

	@Autowired
	private IOrderService orderService;

	@RequestMapping("/detail")
	@ResponseBody
	public RespBean detail(User user, Long orderId) {
		/**
		 * @Author hhwu
		 * @Description //TODO 订单详情，静态界面缓存在前端，这里仅返回order对象数据。
		 * @Date 13:59 2022/6/9
		 * @Param [user, orderId]
		 * @return com.mk.seckill.vo.RespBean
		 **/
		if (user == null) {
			return RespBean.error(RespBeanEnum.SESSION_ERROR);
		}
		OrderDetailVo detail = orderService.detail(orderId);
		return RespBean.success(detail);
	}

}
